< previous page page_35 next page >

Page 35
The minor version number is 0 on Windows 95 and 10 on Windows 98. The major version number for both Windows 95 and Windows 98 is 4.
As a first pass, you might try the following code:
' WinVer Project
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Private Type OSVERSIONINFO
   dwOSVersionInfoSize As Long
   dwMajorVersion As Long
   dwMinorVersion As Long
   dwBuildNumber As Long
   dwPlatformId As Long
   szCSDVersion As String * 128
End Type

Private Declare Function GetVersionEx Lib "kernel32" _
(os As OSVERSIONINFO) As Long

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2


Option Explicit

Private Sub Form_Load()
   Dim os As OSVERSIONINFO
   Dim res As Long
   Dim s$
   Dim nullpos&
   res = GetVersionEx(os)
   If res <> 0 Then ' success
      Select Case os.dwPlatformId
         Case VER_PLATFORM_WIN32_NT
            s$ = "Windows NT version " & os.dwMajorVersion _
            & os.dwMinorVersion
         Case VER_PLATFORM_WIN32_WINDOWS
            s$ = "Windows "
            If os.dwMinorVersion = 10 Then s$ = s$ & "98" Else _
            s$ = s$ & "95"
         Case Else
            s$ = "Unknown OS"

 
< previous page page_35 next page >